package com.hopes.bizz.risk.transfer.constant;

public enum RiskRequestType {

    RISK_UNIT(1, "风险单元"),
    RISK_EVENT(2, "风险事件"),
    RISK_CONTROL_MEASURES(3, "管控措施"),
    RISK_MEASURES_TASK(5, "隐患排查任务"),
    RISK_MEASURES_TASK_RECORD(6, "隐患排查记录"),
    RISK_DANGER_INVESTIGATION(4, "隐患信息"),
    RISK_UNIT_STOP(7, "单元停用/检修记录"),
    ;

    private Integer code;

    private String name;

    RiskRequestType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static RiskRequestType getRiskRequestTypeByCode(Integer code) {
        for (RiskRequestType requestType : RiskRequestType.values()) {
            if (requestType.getCode().equals(code)) {
                return requestType;
            }
        }

        return null;
    }
}
